--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 8a88f1642c6bd50b40d084ec16bf09481af6ab0a
Parents : 5059b93
Author : Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-04-14T22:59:37-05:00
refactor(tests): update MicronEditorPage and NomadPageRenderer tests by updating button selection and improving markdown rendering assertions; adjust performance test timeout for ConversationViewer
Changes
3 files changed, 62 insertions(+), 67 deletions(-)
Diff
diff --git a/tests/frontend/MicronEditorPage.test.js b/tests/frontend/MicronEditorPage.test.js
index 253f1317..ae02bca1 100644
--- a/tests/frontend/MicronEditorPage.test.js
+++ b/tests/frontend/MicronEditorPage.test.js
@@ -85,10 +85,11 @@ describe("MicronEditorPage.vue", () => {
const wrapper = mountMicronEditorPage();
await vi.waitFor(() => expect(wrapper.vm.tabs.length).toBeGreaterThan(0));
- const resetButton = wrapper.findAll("button").find((b) => b.text().includes("tools.micron_editor.reset"));
+ const resetButton = wrapper.findAll("button").find((b) => b.html().includes('data-icon-name="refresh"'));
+ expect(resetButton).toBeDefined();
await resetButton.trigger("click");
expect(micronStorage.clearAll).toHaveBeenCalled();
expect(wrapper.vm.tabs.length).toBe(2); // main and guide
- });
+ }, 20_000);
});
diff --git a/tests/frontend/NomadPageRenderer.security.test.js b/tests/frontend/NomadPageRenderer.security.test.js
index 3a4d22c3..28fa313c 100644
--- a/tests/frontend/NomadPageRenderer.security.test.js
+++ b/tests/frontend/NomadPageRenderer.security.test.js
@@ -214,8 +214,8 @@ describe("NomadPageRenderer fragment and markdown sanitization", () => {
s += String.fromCharCode(Math.floor(Math.random() * 65536));
}
expect(() => sanitizeNomadHtmlFragment(s)).not.toThrow();
- expect(() => renderNomadMarkdown(s)).not.toThrow();
- assertNoDangerousHtmlPatterns(renderNomadMarkdown(s));
+ const mdHtml = renderNomadMarkdown(s);
+ assertNoDangerousHtmlPatterns(mdHtml);
}
- });
+ }, 30_000);
});
diff --git a/tests/frontend/Performance.test.js b/tests/frontend/Performance.test.js
index a7415da3..5f77d920 100644
--- a/tests/frontend/Performance.test.js
+++ b/tests/frontend/Performance.test.js
@@ -124,68 +124,62 @@ describe("UI Performance and Memory Tests", () => {
expect(wrapper.findAll(".conversation-item").length).toBe(numConvs);
expect(renderTime).toBeLessThan(12000);
expect(memGrowth).toBeLessThan(200); // Adjusted for JSDOM/Node.js overhead with 2000 items
- });
-
- it(
- "measures performance of data updates in ConversationViewer",
- async () => {
- const numMsgs = 1000;
- const myLxmfAddressHash = "my_hash";
- const selectedPeer = {
- destination_hash: "peer_hash",
- display_name: "Peer Name",
- };
-
- const wrapper = mount(ConversationViewer, {
- props: {
- myLxmfAddressHash,
- selectedPeer,
- conversations: [selectedPeer],
- config: { theme: "light", lxmf_address_hash: myLxmfAddressHash },
- },
- global: {
- components: {
- MaterialDesignIcon,
- ConversationDropDownMenu: { template: "<div></div>" },
- SendMessageButton: { template: "<div></div>" },
- IconButton: { template: "<button></button>" },
- AddImageButton: { template: "<div></div>" },
- AddAudioButton: { template: "<div></div>" },
- PaperMessageModal: { template: "<div></div>" },
- },
- mocks: {
- $t: (key) => key,
- $i18n: { locale: "en" },
- },
+ }, 60_000);
+
+ it("measures performance of data updates in ConversationViewer", async () => {
+ const numMsgs = 1000;
+ const myLxmfAddressHash = "my_hash";
+ const selectedPeer = {
+ destination_hash: "peer_hash",
+ display_name: "Peer Name",
+ };
+
+ const wrapper = mount(ConversationViewer, {
+ props: {
+ myLxmfAddressHash,
+ selectedPeer,
+ conversations: [selectedPeer],
+ config: { theme: "light", lxmf_address_hash: myLxmfAddressHash },
+ },
+ global: {
+ components: {
+ MaterialDesignIcon,
+ ConversationDropDownMenu: { template: "<div></div>" },
+ SendMessageButton: { template: "<div></div>" },
+ IconButton: { template: "<button></button>" },
+ AddImageButton: { template: "<div></div>" },
+ AddAudioButton: { template: "<div></div>" },
+ PaperMessageModal: { template: "<div></div>" },
},
- });
-
- const chatItems = Array.from({ length: numMsgs }, (_, i) => ({
- type: "lxmf_message",
- is_outbound: i % 2 === 0,
- lxmf_message: {
- hash: `msg_${i}`.padEnd(32, "0"),
- source_hash: i % 2 === 0 ? myLxmfAddressHash : "peer_hash",
- destination_hash: i % 2 === 0 ? "peer_hash" : myLxmfAddressHash,
- content: `Message content ${i}.`.repeat(5),
- created_at: new Date().toISOString(),
- state: "delivered",
- method: "direct",
- progress: 1.0,
- delivery_attempts: 1,
- id: i,
+ mocks: {
+ $t: (key) => key,
+ $i18n: { locale: "en" },
},
- }));
-
- const start = performance.now();
- await wrapper.setData({ chatItems });
- const end = performance.now();
-
- console.log(
- `Updated 1000 messages in ConversationViewer in ${(end - start).toFixed(2)}ms`
- );
- expect(end - start).toBeLessThan(12000);
- },
- 30_000
- );
+ },
+ });
+
+ const chatItems = Array.from({ length: numMsgs }, (_, i) => ({
+ type: "lxmf_message",
+ is_outbound: i % 2 === 0,
+ lxmf_message: {
+ hash: `msg_${i}`.padEnd(32, "0"),
+ source_hash: i % 2 === 0 ? myLxmfAddressHash : "peer_hash",
+ destination_hash: i % 2 === 0 ? "peer_hash" : myLxmfAddressHash,
+ content: `Message content ${i}.`.repeat(5),
+ created_at: new Date().toISOString(),
+ state: "delivered",
+ method: "direct",
+ progress: 1.0,
+ delivery_attempts: 1,
+ id: i,
+ },
+ }));
+
+ const start = performance.now();
+ await wrapper.setData({ chatItems });
+ const end = performance.now();
+
+ console.log(`Updated 1000 messages in ConversationViewer in ${(end - start).toFixed(2)}ms`);
+ expect(end - start).toBeLessThan(12000);
+ }, 30_000);
});
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────